package org.liquidByte.simpleChat.communication;

public class ChannelResponse extends ChannelData {
	private static final long serialVersionUID = 4143650352443803903L;
	private Object returns;
	private Exception exception;
	
	private ChannelResponse(ChannelCall call) {
		super(call.getIdentifier());
	}
	public ChannelResponse(ChannelCall call, Exception exception) {
		this(call);
		this.exception = exception;
	}
	public ChannelResponse(ChannelCall call, Object returns) {
		this(call);
		this.returns = returns;
	}
	public boolean isResponseOf(ChannelCall call) {
		return this.getIdentifier() == call.getIdentifier();
	}
	public Object getReturns() {
		return returns;
	}
	public Exception getException() {
		return exception;
	}
	public boolean hasError() {
		return this.exception != null;
	}
	@Override
	public Type getType() {
		return Type.RESPONSE;
	}
}
